﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static System.Runtime.InteropServices.JavaScript.JSType;
using System.Data.SqlClient;
using yunbo.Model.SM;
using yunbo.Repositorys.SMRepositorys;

namespace yunbo.Controllers.SMControllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class WMS_CKBController : ControllerBase
    {
        WMS_CKBRepository _wms_ckRepository=new WMS_CKBRepository();
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="tjwms_ck"></param>
        /// <returns></returns>
        [HttpPost("PostWMS_CKB")]
        public IActionResult PostWMS_CKB(TJWMS_CKB tjwms_ck)
        {
            //tjwms_ck.ckb_type = "调拨出库";
            tjwms_ck.ckb_shzt = 1;
            tjwms_ck.create_time = DateTime.Now;
            bool rs = _wms_ckRepository.PostWMS_CK(tjwms_ck) > 0;
            return Ok(rs);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="tjwms_ck"></param>
        /// <returns></returns>
        [HttpGet("GetCXWMS_CKB")]
        public IActionResult GetCXWMS_CKB(int PageNumber, int PageSize)
        {
            FYCXWMS_CKB fYCXWMS_CKB = _wms_ckRepository.GetCXWMS_CKB(PageNumber, PageSize);
            return Ok(fYCXWMS_CKB);
        }
        /// <summary>
        /// 修改状态
        /// </summary>
        /// <returns></returns>
        [HttpPut("UpdateWMS_CK")]
        public IActionResult UpdateWMS_CK(int fzr, int uid, string code, int zt)
        {
            bool rs = _wms_ckRepository.UpdateWMS_CK(fzr, uid, code, zt) > 0;
            return Ok(rs);
        }
    }
}
